/*
 * Progress.java
 *
 * Created on 11 Июль 2010 г., 14:53
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package chatty.ui;

import chatty.SplashCanvas;
import chatty.cl.ContactList;
import chatty.util.ResBundle;
import protocol.Protocol;

/**
 *
 * @author Vladimir Kryukov
 */
public class Progress {
    private boolean canceled;
    
    public Progress() {
    }
    public void init(String captionLngStr) {
        canceled = false;
        SplashCanvas.setProgressBar(this);
        SplashCanvas.setMessage(ResBundle.getString(captionLngStr));
        setProgress(0);
    }

    public void setProgress(int percent) {
        SplashCanvas.setProgress(percent);
        if (0 == percent) {
            canceled = false;
            SplashCanvas.showSplash();
        }
        if (100 == percent) {
            SplashCanvas.setProgressBar(null);
            ContactList.activateContactList();
        }
    }
    public boolean isCanceled() {
        return canceled;
    }
    public void closeAnyAction() {
        canceled = true;
        ContactList.activateContactList();
    }
}
